{include file="public/header" /}

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <!-- Panel Other -->
        <div class="ibox float-e-margins">
           
            <div class="ibox-content">
                <!--搜索框开始-->
                <div class="row">
                    <div class="col-sm-12">
                       
                        <form name="admin_list_sea" class="form-search" method="post" action="{:url('select_member')}">
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <select class="form-control m-b chosen-select" name="organization_id" id="organization_id">
                                        <option value="">==请选择组织==</option>
                                        {if !empty($org)}
                                            {foreach name="org" item="vo"}
                                                <option value="{$vo.id}" {if condition="$organization_id eq $vo['id']"}selected{/if}>{$vo.title}</option>
                                            {/foreach}
                                        {/if}
                                    </select>
                                </div>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <select class="form-control m-b chosen-select" name="group_id" id="group_id">
                                        <option value="">==请选择部门==</option>
                                        {if !empty($groups)}
                                            {foreach name="groups" item="vo"}
                                                <option value="{$vo.id}" {if condition="$group_id eq $vo['id']"}selected{/if}>{$vo.group_name}</option>
                                            {/foreach}
                                        {/if}
                                    </select>
                                </div>
                            </div>
                            <div class="col-sm-5">
                                <div class="input-group">
                                    <input type="text" id="key" class="form-control" name="key" value="{$val}" placeholder="输入需查询的工号/姓名/手机号" />
                                    <span class="input-group-btn"> 
                                    <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button> 
                                </span>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!--搜索框结束-->
                <div class="example-wrap">
                    <div class="example">
                        <table class="table table-bordered table-hover">
                            <thead>
                                <tr class="long-tr">
                                    <th width="4%">ID</th>
                                    <th width="9%">工号</th>
                                    <th width="5%">姓名</th>
                                    <th width="3%">性别</th>
                                    <th width="10%">所属部门</th>
                                    <th width="5%">照片</th>
                                    <th width="10%">手机号码</th>
                                </tr>
                            </thead>
                            <script id="list-template" type="text/html">
                                {{# for(var i=0;i
                                <d.length;i++){ }} <tr class="long-td">
                                    <td>{{d[i].id}}</td>
                                    <td><a href="#" onclick="selectmember('{{d[i].id}}','{{d[i].nickname}}');">{{d[i].username}}</a></td>
                                    <td>{{d[i].nickname}}</td>
                                    <td>{{# if(d[i].sex==1){ }}
                                       男
                                        {{# }else{ }}
                                       女
                                        {{# } }}</td>
                                    <td>{{d[i].group_name}}</td>
                                    <td>
                                        
                                        <img src="{{d[i].avatar}}" class="img-circle" style="width:35px;height:35px" onerror="this.src='/static/admin/images/head_default.gif'" />
                                        <!-- <img src="/uploads/face/{{d[i].head_img}}" class="img-circle" style="width:35px;height:35px" onerror="this.src='/static/admin/images/head_default.gif'" /> -->
                                    </td>
                                    <td>{{d[i].mobile}}</td>
                                    </tr>
                                    {{# } }}
                            </script>
                            <tbody id="list-content"></tbody>
                        </table>
                        <div id="AjaxPage" style=" text-align: right;"></div>
                        <div id="allpage" style=" text-align: right;"></div>
                    </div>
                </div>
                <!-- End Example Pagination -->
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
    </div>

 

    {include file="public/footer" /}

    <script type="text/javascript">
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        function selectmember(id,name)
        {
            parent.$('#member_id').val(id);
            parent.$('#member_name').val(name);
            parent.layer.tips(name, '#member_name', {time: 5000});
            parent.layer.close(index);
        }
        //laypage分页
        Ajaxpage();

        function Ajaxpage(curr) {
            var key = $('#key').val();
            var organization_id = $('#organization_id').val();
            var group_id = $('#group_id').val();
            $.getJSON('{:url("Member/select_member")}', {
                page: curr || 1,
                key: key,
                organization_id: organization_id,
                group_id: group_id
            }, function(data) {
                $(".spiner-example").css('display', 'none'); //数据加载完关闭动画 
                if (data == '') {
                    $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
                } else {
                    var tpl = document.getElementById('list-template').innerHTML;
                    laytpl(tpl).render(data, function(html) {
                        document.getElementById('list-content').innerHTML = html;
                    });
                    laypage({
                        cont: $('#AjaxPage'), //容器。值支持id名、原生dom对象，jquery对象,
                        pages: '{$allpage}', //总页数
                        skip: true, //是否开启跳页
                        skin: '#1AB5B7', //分页组件颜色
                        curr: curr || 1,
                        groups: 3, //连续显示分页数
                        jump: function(obj, first) {
                            if (!first) {
                                Ajaxpage(obj.curr)
                            }
                            $('#allpage').html('第' + obj.curr + '页，共' + obj.pages + '页');
                        }
                    });
                }
            });
        }

       
    </script>
</body>

</html>